package com.core.pdf;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 打印条形码
 */
@Slf4j
public class PdfHelper {
    //执行
    private ExecutorService es = Executors.newSingleThreadExecutor();

    /**
     * 打印
     *
     * @param barCode
     * @throws Exception
     */
    public void printPdf(final String barCode) throws Exception {
        String pm = OpcUaConfig.getInstance().getPrintMode();
        if (!"Y".equalsIgnoreCase(pm)) {
            return;
        }
        es.submit(new Runnable() {
            @Override
            public void run() {
                try {
                    PdfHelper1 helper1 = new PdfHelper1();
                    helper1.printPdf(barCode);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        });
    }


}
